package auth

import (
	"errors"
)

type User struct {
	name string
	age  int
	sex  string
}

var mockTokenMap = map[string]User{
	"111":                 {name: "张三疯", age: 12, sex: "男"},
	"222":                 {name: "王五", age: 13, sex: "女"},
	"333":                 {name: "马桂英", age: 23, sex: "女"},
	"1934293164587802625": {name: "凌明磊", age: 23, sex: "男"},
	"1941831987785310209": {name: "王小虎", age: 23, sex: "男"},
}

func GetUserIdByToken(token string) (User, error) {
	userInfo, ok := mockTokenMap[token]
	if !ok {
		return User{}, errors.New("invalid token")
	}
	return userInfo, nil
}
